#include<stdio.h>
#include<math.h>

int isprime(int x)
{
	int back=1;
	int i;
	if(x==1||(x%2==0&&x!=2)) back=0;
	for(i=3;i<=sqrt((double)x);i+=2){
		if(x%i==0){
			back=0;
			break;
		}
	}
	return back;
} 
int main()
{
	int n;
	scanf("%d",&n);
	if(isprime(n)==1) printf("YES");
	else printf("NO");
	return 0; 
}
